#ifndef HTTP_CLIENT_H
#define HTTP_CLIENT_H


#include <QCoreApplication>
#include <QHttp>
#include <QByteArray>

class HttpClient: public QObject
{
        Q_OBJECT
	private:
		QHttp* mHttp;
		void outData(QByteArray data);
        public:
                bool finished;
                QByteArray data;
                QString qData;
                QString qCookies;
                QString qLocation;
                QString qHost;
                int response;
                int waitTimeout;
                HttpClient(QString host, QObject* parent=0);
                ~HttpClient();
                void setProxyInfo(bool useProxy, QString proxyHost, int proxyPort, bool useAuthorization, QString proxyUserName, QString proxyPassword);
                void addCookies(QString cookies);
                void setTimeout(int timeout);
                void doRequest(QString qHost, QString url); // GET
                void doRequest(QString qHost, QString url, QByteArray content); // POST
                void wait(); // wait till we close connection..

	public slots:
                void done(bool error);
		void responseHeaderReceived(const QHttpResponseHeader& resp);
		void readyRead(const QHttpResponseHeader & resp);
};

#endif // HTTP_CLIENT_H
